<extend name="public:base" />

<block name="left">
	<div class="mark_bar cl">
		<a href="{:url('uc/safe/index')}" class="goback fl"><i class="iconfont">&#xe600;</i></a>
		<p>实名认证</p>
	</div>
</block>

<block name="main">
	<if condition="$id_status neq 1">
		<div class="content">
			<form action="{:url('uc/safe/real_name_bind_bank')}" method="post" id="form">
				<div class="form">
					<p class="tc red">银行预留的手机号码必须与注册手机号一致！</p>
					<p class="slarge tc pt1">{$phone|substr=0,3}****{$phone|substr=-4,4}</p>
					<p class="pt05"></p>
					<input type="hidden" name="bank_code" id="bankCode">
					<input type="hidden" name="bank_name" id="bankName">
					<input type="hidden" name="borrow_id" value="{$Think.get.borrow_id}">
					<input type="hidden" name="debt_id" value="{$Think.get.debt_id}">
					<div class="input_form">
						<div class="input_form_bar">
							<p>真实姓名</p>
							<input name="real_name" id="real_name" placeholder="请输入你的真实姓名" type="text" autocomplete="off" value="{$data.real_name}" />
							<div class="cl"></div>
						</div>
						<div class="input_form_bar">
							<p>身份证号</p>
							<input name="idcard" id="idcard" placeholder="请输入您的身份证号码" type="text" autocomplete="off" value="{$data.idcard}"/>
							<div class="cl"></div>
						</div>
						<div class="input_form_bar">
							<p>银行卡号</p>
							<input type="tel" name="card_id" id="card_id" size="19" maxlength="19" placeholder="请输入银行卡号" value="{$data.card_id}" autocomplete="off"/>
							<div class="cl"></div>
						</div>
						<div class="input_form_bar">
							<p>开户银行</p>
							<select id="selectBank">
								<volist name="bank_list" id="v">
								<option value="{$v.bank_code}" <if condition="$v.bank_code eq $data.bank_code">selected="selected"</if>>{$v.bank_name}</option>
								</volist>
							</select>
							<div class="cl"></div>
						</div>
					</div>
					<div class="wrap">
						<button class="submit" type="submit">立即认证</button>
						<div class="cl"></div>
					</div>
				</div>
			</form>
		</div>

		<else/>

		<div class="content">
			<div class="center_link_list">
				<ul>
					<li>
						<span>真实姓名</span>
						<i class="small fr a999">
							*{$info.real_name|mb_substr=1,3,'utf-8'}
						</i>
						<div class="cl"></div>
					</li>
					<li>
						<span>身份证号</span>
						<i class="small fr a999">{$info.idcard|substr=0,6}****{$info.idcard|substr=-4,4}</i>
						<div class="cl"></div>
					</li>
				</ul>
			</div>
		</div>
	</if>
</block>

<block name="menu"></block>

<block name="js">
	<if condition="$id_status neq 1">
		<script type="text/javascript" src="__JS__/check.js?v={:config('app_ver')}"></script>
		<script type="text/javascript">
			$('#form').submit(function() {
				if(!checkRealname()) return false;
				if(!checkIdcard()) return false;
				if (!checkBankcard()) return false;
				if($("#bankCode").val().length <=0){
					wjtips("请选择开户银行！");
					return false;
				}
				return ajax_post($(this));
			});

			$("#selectBank").each(function () {
				var selected = $(this).find("option:selected");
				$("#bankCode").val(selected.val());
				$("#bankName").val(selected.html());
				$(this).change(function () {
					$("#bankCode").val($(this).val());
					$("#bankName").val($(this).find("option:selected").html());
				});
			})
		</script>
	</if>
</block>
